package 电信数据清洗;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class A {
    public static void main(String[] args) throws   Exception{
        String str = "18620192711,15733218050,1000642457633,1506628265,650000,810000";
        String data = "2021年03月02日";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH时");
        DateFormat dataFormat = DateFormat.getDateInstance(DateFormat.LONG);
        Date s1 = dataFormat.parse(data);
        System.out.println(s1);
        String data1 = simpleDateFormat.format(s1);
        System.out.println(data1);
        String [] datas = str.split(",");
        Long timeStamp = System.currentTimeMillis();  //获取当前时间戳

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        String sd = sdf.format(Long.parseLong(String.valueOf(timeStamp)));
        String sd2 = sdf.format(new Date(Long.parseLong(String.valueOf(timeStamp))));
        String sd3 = sdf.format(timeStamp);
        System.out.println("格式化结果：" + sd);
        System.out.println("格式化结果：" + sd2);
        System.out.println("格式化结果：" + sd3);
        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date = s.format(Long.parseLong(datas[2]));
        System.out.println(Long.parseLong(datas[3])-Long.parseLong(datas[2]));
        System.out.println(date);
    }
}
